<%--
  Created by IntelliJ IDEA.
  User: lucky
  Date: 2020/12/16
  Time: 9:36
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="cc" uri="http://java.sun.com/jsp/jstl/core" %>

<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>

<html>
<head>
    <title>springMVC</title>
</head>
<body>
<h1>HELLO CONTROLLER</h1>
<p>request</p>
<table border="1px" cellpadding="10px" cellspacing="0" bgcolor="#a9a9a9">
    <tr>
        <th>编号</th>
        <th>姓名</th>
        <th>电话</th>
        <th>密码</th>
        <th>注册时间</th>

        <th>角色名称</th>
        <th>角色详情</th>
        <th>角色等级</th>
    </tr>
    <cc:forEach items="${requestScope.request}" var="user">
        <tr>
            <td>${user.userId}</td>
            <td>${user.username}</td>
            <td>${user.userTel}</td>
            <td>${user.password}</td>
            <td>
                <fmt:formatDate
                        value="${user.registrationTime}"
                        type="both"
                        dateStyle="full"
                        timeStyle="long"
                ></fmt:formatDate>
            </td>
            <td>${user.roles[0].roleName}</td>
            <td>${user.roles[0].roleInfo}</td>
            <td>${user.roles[0].roleLevel}</td>
        </tr>
    </cc:forEach>
</table>

<hr>
<p>session</p>
<table border="1px" cellpadding="10px" cellspacing="0" bgcolor="#ccc">
    <tr>
        <th>编号</th>
        <th>姓名</th>
        <th>电话</th>
        <th>注册时间</th>
    </tr>
    <cc:forEach items="${sessionScope.session}" var="user">
        <tr>
            <td>${user.userId}</td>
            <td>${user.username}</td>
            <td>${user.userTel}</td>
            <td>
                <!--
                1)fmt:formatDate 来源于 http://java.sun.com/jsp/jstl/fmt
                2)fmt:formatDate作用是格式化日期的显示，例如：2015年5月10日 星期日
                3)value表示需要格式化的值
                4)type表示显示日期,时间,都显示
                  type=date表示只显示日期
                  type=time表示只显示时间
                  type=both表示日期时间均显示
                5)dateStyle表示显示日期的格式：short/medium/default/long/full
                -->

                <fmt:formatDate
                        value="${user.registrationTime}"
                        type="both"
                        dateStyle="full"
                        timeStyle="long"
                ></fmt:formatDate>
            </td>
        </tr>
    </cc:forEach>
</table>
<hr>
<p>modelMap</p>
<table border="1px" cellpadding="10px" cellspacing="0" bgcolor="#a9a9a9">
    <tr>
        <th>编号</th>
        <th>姓名</th>
        <th>电话</th>
        <th>密码</th>
        <th>注册时间</th>

        <th>角色名称</th>
        <th>角色详情</th>
    </tr>
    <cc:forEach items="${requestScope.modelMap}" var="user">
        <tr>
            <td>${user.userId}</td>
            <td>${user.username}</td>
            <td>${user.userTel}</td>
            <td>${user.password}</td>
            <td>
                <fmt:formatDate
                        value="${user.registrationTime}"
                        type="both"
                        dateStyle="full"
                        timeStyle="long"
                ></fmt:formatDate>
            </td>
            <td>${user.roles[0].roleName}</td>
            <td>${user.roles[0].roleInfo}</td>
        </tr>
    </cc:forEach>
</table>
<hr>
<p>modelAndView</p>
<table border="1px" cellpadding="10px" cellspacing="0" bgcolor="#a9a9a9">
    <tr>
        <th>编号</th>
        <th>姓名</th>
        <th>电话</th>
        <th>密码</th>
        <th>注册时间</th>

        <th>角色名称</th>
        <th>角色详情</th>
    </tr>
    <cc:forEach items="${requestScope.modelAndView}" var="user">
        <tr>
            <td>${user.userId}</td>
            <td>${user.username}</td>
            <td>${user.userTel}</td>
            <td>${user.password}</td>
            <td>
                <fmt:formatDate
                        value="${user.registrationTime}"
                        type="both"
                        dateStyle="full"
                        timeStyle="long"
                ></fmt:formatDate>
            </td>
            <td>${user.roles[0].roleName}</td>
            <td>${user.roles[0].roleInfo}</td>
        </tr>
    </cc:forEach>
</table>
<hr>
<p>controller</p>
<table border="1px" cellpadding="10px" cellspacing="0" bgcolor="#a9a9a9">
    <tr>
        <th>编号</th>
        <th>姓名</th>
        <th>电话</th>
        <th>密码</th>
        <th>注册时间</th>

        <th>角色名称</th>
        <th>角色详情</th>
    </tr>
    <cc:forEach items="${requestScope.controller}" var="user">
        <tr>
            <td>${user.userId}</td>
            <td>${user.username}</td>
            <td>${user.userTel}</td>
            <td>${user.password}</td>
            <td>
                <fmt:formatDate
                        value="${user.registrationTime}"
                        type="both"
                        dateStyle="full"
                        timeStyle="long"
                ></fmt:formatDate>
            </td>
            <td>${user.roles[0].roleName}</td>
            <td>${user.roles[0].roleInfo}</td>
        </tr>
    </cc:forEach>
</table>
<hr>
<p>handler</p>
<table border="1px" cellpadding="10px" cellspacing="0" bgcolor="#a9a9a9">
    <tr>
        <th>编号</th>
        <th>姓名</th>
        <th>电话</th>
        <th>密码</th>
        <th>注册时间</th>

        <th>角色名称</th>
        <th>角色详情</th>
    </tr>
    <cc:forEach items="${requestScope.handler}" var="user">
        <tr>
            <td>${user.userId}</td>
            <td>${user.username}</td>
            <td>${user.userTel}</td>
            <td>${user.password}</td>
            <td>
                <fmt:formatDate
                        value="${user.registrationTime}"
                        type="both"
                        dateStyle="full"
                        timeStyle="long"
                ></fmt:formatDate>
            </td>
            <td>${user.roles[0].roleName}</td>
            <td>${user.roles[0].roleInfo}</td>
        </tr>
    </cc:forEach>
</table>
</body>
</html>
